using System.Collections;
using System.Collections.Generic;
using Hotran.SaveSystem;
using UnityEngine;

public class PositionSaver : MonoBehaviour, ISavable
{
    private struct SaveData
    {
        public Vector3 Position;
        public Vector3 Velocity;
    }


    public object Save()
    {
        return new SaveData()
        {
            Position = transform.position,
            Velocity = GetComponent<Rigidbody2D>().velocity
        };
    }

    public void Load(object data)
    {
        SaveData saveData = (SaveData)data;
        transform.position = saveData.Position;
        GetComponent<Rigidbody2D>().velocity = saveData.Velocity;
    }
}
